const isLogin = () => {
  return !!localStorage.getItem('token');
};

const getToken = () => {
  return localStorage.getItem('token');
};

const setToken = (token: string) => {
  localStorage.setItem('token', token);
};

const clearToken = () => {
  localStorage.removeItem('token');
};

const setUserInfo = (info) => {
  localStorage.setItem("UserInfo", JSON.stringify(info || ""));
}

const getUserInfo = () => {
  const info = localStorage.getItem('UserInfo');
  return JSON.parse(info || "");
}

export { isLogin, getToken, setToken, clearToken, setUserInfo, getUserInfo };
